<template>
    <view class="content">
        <view class="box">
			<view>选择星级</view>
			<view class="rate">
				<u-rate v-model="value" :count="5" :min-count="1" active-color="#fcc206" size="50"></u-rate>
			</view>
		</view>
		<view class="box">
			<textarea v-model="content" maxlength="200" placeholder="欢迎您的评价与反馈~" class="t-inp"></textarea>
		</view>
		<view class="btn" @click="doSubmit">确定</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                value: 5,
				content: '',
				id: '',
            };
        },
        onLoad(option) {
            this.id = option.id
        },
        methods: {
            doSubmit() {
				if (!this.content) {
					this.$toast('请输入您的评价与反馈')
					return
				}
				this.$ajax('add_evaluates', {
				    userToken: this.$getSync('userToken'),
					subscribes_id: this.id,//体检记录编号
					level: this.value,
					content: this.content
				}).then(ret => {
					if (ret.status == 0) {
				        this.$toast('提交成功')
						setTimeout(() => {
							this.$backT()
						}, 500)
					} else {
						this.$toast(ret.message);
					}
				});
			},
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #f5f5f5;
    }
	.content{
		padding: 20rpx;
	}
	.box{
		padding: 35rpx 30rpx;
		margin-bottom: 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
	}
	.rate{
		text-align: center;
		padding-top: 10rpx;
	}
	.t-inp{
		width: 100%;
		height: 450rpx;
		font-size: 28rpx;
		line-height: 1.5;
	}
	.btn{
		font-size: 30rpx;
		color: #fff;
		text-align: center;
		padding: 25rpx;
		margin: 70rpx 0;
		background: #01b8bd;
		border-radius: 50rpx;
	}

</style>
